home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6963 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  42 lines

  1. Newsgroups: comp.lang.ada,comp.lang.c++
  2. Path: news.bton.ac.uk!je
  3. From: je@bton.ac.uk (John English)
  4. Subject: Re: on OO differnces between Ada95 and C++
  5. Message-ID: <Dn4J2F.uI@bton.ac.uk>
  6. Followup-To: comp.lang.ada,comp.lang.c++
  7. Organization: University of Brighton, UK
  8. X-Newsreader: TIN [version 1.2 PL2]
  9. References: <4gbq7q$g08@qualcomm.com>
  10. Date: Wed, 21 Feb 1996 11:39:51 GMT
  11.  
  12. Nasser Abbasi (nabbasi@qualcomm.com) wrote:
  13. : Lets also assume that we need to define a Money Type, defined in
  14. : the base class Account.     
  15.  
  16. : In Ada95 this type is defined in the package Account.ads that also
  17. : includes the definition of the tagged record type Account (along with
  18. : operations that act on Account type).
  19.  
  20. : Now, In Ada95, a client that wishes to use Saving_Account type (and
  21. : any operations on it) will "with" the Saving_Account Package.
  22.  
  23. If the spec of Saving_Account has "with Account" at the beginning,
  24. "with Saving_Account" will imply "with Account".  Or use child
  25. packages: make Saving_Account a child of Account (e.g. Account.Saving)
  26. so that it is effectively an extension of Account.
  27.  
  28. : In C++, the client to the saving_account class can also use the
  29. : Money_Type type (even though that is defined in
  30. : the base class Account) without having to include base class
  31. : "account.h", this is because Money_Type has become a public part of the
  32. : Saving_Account class when Saving_Account inherited Saving class.
  33.  
  34. You can always put "subtype Money_Type is Account.Money_Type" in
  35. Saving_Account to make it directly usable from Saving_Account...
  36.  
  37. -- 
  38. ----------------------------------------------------------------------------
  39. John English <je@brighton.ac.uk>, Dept. of Computing, University of Brighton
  40.   "Disks are divided into sex and tractors..."
  41. ----------------------------------------------------------------------------
  42.